package com.example.mvp.mvppromote.ui.activity;

import android.content.Context;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.example.mvp.mvppromote.R;
import com.example.mvp.mvppromote.base.BaseActivity;
import com.example.mvp.mvppromote.presenter.LineViewPresenter;
import com.example.mvp.mvppromote.ui.iview.ILineView;
import com.example.mvp.mvppromote.ui.view.LineView;

import java.util.ArrayList;

import butterknife.BindView;


public class LineViewActivity extends BaseActivity<LineViewPresenter> implements ILineView {


    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.lineView)
    LineView lineView;
    @BindView(R.id.fab)
    FloatingActionButton fab;

    @Override
    protected LineViewPresenter getPresenter() {
        return new LineViewPresenter(this);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_line_view;
    }

    @Override
    protected void initData() {
        toolbar.setNavigationIcon(R.drawable.button_selector_back);
        toolbar.setTitle("折线图");
        setSupportActionBar(toolbar);
        mPresenter.loadLineView();
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getPresenter().loadLineView();
            }
        });
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    @Override
    public void loadLineView(ArrayList<ArrayList<Integer>> arrayLists) {
        lineView.setDataList(arrayLists);
    }

    @Override
    public Context getMyContext() {
        return this;
    }
}
